package com.tanhua.server.controller;

import com.tanhua.model.vo.PageResult;
import com.tanhua.server.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiduController {
    @Autowired
    private BaiduService baiduService;


    /**
     * 上报地理位置
     */
    @PostMapping("/location")
    public ResponseEntity updateLocation(@RequestBody Map param){
        Double longitude = Double.valueOf(param.get("longitude").toString()) ;
        Double latitude = Double.valueOf(param.get("latitude").toString()) ;
        String address = param.get("addrStr").toString();
        this.baiduService.updateLocation(longitude,latitude,address);
        return ResponseEntity.ok(null);
    }
}
